package com.emily.test.service.impl;

import com.emily.test.mapper.TUserMapper;
import com.emily.test.model.TUser;
import com.emily.test.service.TUserService;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service("tUserServiceAgent")
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT,timeout=36000,rollbackFor=Exception.class)
public class TUserServiceImpl implements TUserService {
    @Resource
    private TUserMapper tUserMapper;

    @Override
    public TUser selectUserInfoByLoginName(String loginName) {
        return tUserMapper.selectUserInfoByLoginName(loginName);
    }

    @Override
    public Map<String, Object> getUserAllInfoMap(TUser tUser) {
        return tUserMapper.getUserAllInfoMap(tUser);
    }

    @Override
    public List<Map<String, Object>> getRolesByUserId(Integer userId) {
        return tUserMapper.getRolesByUserId(userId);
    }

    @Override
    public List<Map<String, Object>> getResourceInfoByRoleIdsList(List<Integer> roleIdsList) {
        return tUserMapper.getResourceInfoByRoleIdsList(roleIdsList);
    }

    @Override
    public Map<String, Object> getCompanyInfoByCode(String companyCode) {
        return tUserMapper.getCompanyInfoByCode(companyCode);
    }

    @Override
    public List<Map<String, Object>> getResourceInfoByCompanyIdList(Integer companyId) {
        return tUserMapper.getResourceInfoByCompanyIdList(companyId);
    }

    @Override
    public List<Map<String, Object>> getMenuListByRoleIds(List<Integer> roleIdsList) {
        return tUserMapper.getMenuListByRoleIds(roleIdsList);
    }
}
